﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for User
/// </summary>
public class Users
{
    public static bool selected;
    public static bool selected_leader;
    public static bool search_leader;
    public static bool selected_w;
    public static int row;
    public static DataTable tableEmploy;
    public static int _userID = -1;
    public static string _UserName = "";
    public static string _deparmentID = "";
    public static string _password = "";
    public static string _displayName = "";
    public static string _emplyeeName = "";
    public static string _title = "";
    public static string _shiftcode = "";
    public static string _gender = "";
    public static DateTime _birthday = DateTime.Now;
    public static string _email = "";
    public static string _phone = "";
    public static string _refWarehouseCode = "";
    public static string _employeeCode = "";
    public static DateTime _lastLoginTime = DateTime.Now;
    public static int _LoginFailNumber = 0;
    public static string _remark = "";
    public static string _address = "";
    public static char _status = 'A';
    public static int _createdBy = -1;
    public static DateTime _createdDateTime = DateTime.Now;
    public static int _lastUpdatedBy = -1;
    public static DateTime _lastUpdatedDateTime = DateTime.Now;
    public static int _rowVersion = 1;
    public static string _leaderName = "";
    public static string _leaderCode = "";
    public static string _employeeType = "";
    public static string _contractType = "";
    public static string _regionCode = "";
    public static string _regionName = "";
    public static DateTime CompanyLeavingDay = DateTime.Now;
    public static DateTime ContractDate = DateTime.Now;
    public static DateTime Official = DateTime.Now;
    public static DateTime _contractExpiredDate = DateTime.Now;
    public static string _warehouseName = "";
    public static bool _isWork;
    public static bool _checkIP;
    public static bool _chkEmployeeType;
    public int RowVersion
    {
        get { return _rowVersion; }
        set { _rowVersion = value; }
    }

    public DateTime LastUpdatedDateTime
    {
        get { return _lastUpdatedDateTime; }
        set { _lastUpdatedDateTime = value; }
    }

    public int LastUpdatedBy
    {
        get { return _lastUpdatedBy; }
        set { _lastUpdatedBy = value; }
    }

    public DateTime CreatedDateTime
    {
        get { return _createdDateTime; }
        set { _createdDateTime = value; }
    }

    public int CreatedBy
    {
        get { return _createdBy; }
        set { _createdBy = value; }
    }

    public char Status
    {
        get { return _status; }
        set { _status = value; }
    }

    public string Remark
    {
        get { return _remark; }
        set { _remark = value; }
    }

    public int LoginFailNumber
    {
        get { return _LoginFailNumber; }
        set { _LoginFailNumber = value; }
    }

    public DateTime LastLoginTime
    {
        get { return _lastLoginTime; }
        set { _lastLoginTime = value; }
    }

    public string EmployeeCode
    {
        get { return _employeeCode; }
        set { _employeeCode = value; }
    }

    public string RefWarehouseCode
    {
        get { return _refWarehouseCode; }
        set { _refWarehouseCode = value; }
    }

    public string Address
    {
        get { return _address; }
        set { _address = value; }
    }

    public string Phone
    {
        get { return _phone; }
        set { _phone = value; }
    }

    public string Email
    {
        get { return _email; }
        set { _email = value; }
    }


    public DateTime Birthday
    {
        get { return _birthday; }
        set { _birthday = value; }
    }

    public string Gender
    {
        get { return _gender; }
        set { _gender = value; }
    }

    public string Title
    {
        get { return _title; }
        set { _title = value; }
    }

    public static string Shiftcode
    {
        get { return _shiftcode; }
        set { _shiftcode = value; }
    }

   
    public string DisplayName
    {
        get { return _displayName; }
        set { _displayName = value; }
    }

    public string Password
    {
        get { return _password; }
        set { _password = value; }
    }

    public string DeparmentID
    {
        get { return _deparmentID; }
        set { _deparmentID = value; }
    }

    public string UserName
    {
        get { return _UserName; }
        set { _UserName = value; }
    }

    public int UserID
    {
        get { return _userID; }
        set { _userID = value; }
    }

    public string WarehouseName
    {
        get { return _warehouseName; }
        set { _warehouseName = value; }
    }
    public string RegionCode
    {
        get { return _regionCode; }
        set { _regionCode = value; }
    }
    public string RegionName
    {
        get { return _regionName; }
        set { _regionName = value; }
    }
    public bool ChkEmployeeType
    {
        get { return _chkEmployeeType; }
        set { _chkEmployeeType = value; }
    }
   
//    private void btnExport_Click(object sender, EventArgs e)
//    {
//        SaveFileDialog save = new SaveFileDialog();
//        save.Filter = "Excel file *.xls|*.xls";
//        if (save.ShowDialog() == DialogResult.OK)
//        {

//            Excel.Application xlApp;
//            Excel.Workbook xlWorkBook;
//            Excel.Worksheet xlWorkSheet;
//            object misValue = System.Reflection.Missing.Value;

//            xlApp = new Excel.ApplicationClass();
//            xlWorkBook = xlApp.Workbooks.Add(misValue);
//            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
//            int i = 0;
//            int j = 0;

//            for (i = 0; i <= dataGridHoaDonTheoNgay.RowCount - 1; i++)
//            {
//                for (j = 0; j <= dataGridHoaDonTheoNgay.ColumnCount - 1; j++)
//                {

//                    DataGridViewCell cell = dataGridHoaDonTheoNgay[j, i];
//                    xlWorkSheet.Cells[1, j + 1] = dataGridHoaDonTheoNgay.Columns[j].Name;

//                    xlWorkSheet.Cells[i + 2, j + 1] = cell.Value;

//                }
//            }

//            xlWorkBook.SaveAs(save.FileName, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
//            xlWorkBook.Close(true, misValue, misValue);
//            xlApp.Quit();

//            releaseObject(xlWorkSheet);
//            releaseObject(xlWorkBook);
//            releaseObject(xlApp);

//            MessageBox.Show("Excel file created ");
//        }
//    }
//    private void releaseObject(object obj)
//{
//try
//{
//System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj);
//obj = null;
//}
//catch (Exception ex)
//{
//obj = null;
//MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
//}
//finally
//{
//GC.Collect();
//}
//}
}